"""
@name : 6.经典类与新式类
@author : wenyao
@projectname: sanchuanglianxi
"""
#python 类是可以多继承的
# class A:
#     def test(self):
#         print("from A")
#
# class B(A):
#     def test(self):
#         print("from B")
#
# class C(A):
#     def test(self):
#         print("from C")
#
# class D(B):
#     def test(self):
#         print("from D")
#
# class E(C):
#     def test(self):
#         print("from E")
#
# class F(D,E):
#     def test(self):
#         print("from F")
#
# f = F()
# f.test()

#python2
#新式类
# class N1(object):
#     def talk(self):
#         print("N1")
#
# class N2(N1):
#     pass

#经典类
# class P1:
#     def talk(self):
#         print("P1")
#
# class P3:
#     def talk(self):
#         print("P3")
#
# class P2(P1):
#     # def talk(self):
#     #     print("P2")
#     pass
#
# class K(P2,P3):
#     pass
#
# k = K()
# k.talk()

# class A:
#     pass
# class B:
#     pass
#
# a = A()
# b = B()
#
# print(type(a))
# print(type(b))
# print(type(a) == type(b))
# print(a.__class__)
# print(b.__class__)

#新式类和经典类的区别
class A:
    def test(self):
        print("from A")

class B(A):
    def test(self):
        print("from B")
    pass

class C(A):
    def test(self):
        print("from C")
    pass

class D(B):
    def test(self):
        print("from D")
    pass

class E(C):
    def test(self):
        print("from E")
    pass
class F(D,E,B):
    # def test(self):
    #     print("from F")
    pass

f1 = F()
f1.test()
#查找顺序 F -->D -->B -->E -->C -->A
#新式类默认是按照广度优先的算法
#子类会先于父类被检查
#多个父类，会根据他们在列表中的顺序被检查

#经典类查找顺序
#F --》D --》B --》A -->E -->C